//! @Author: DengLibin
//! @Date: Create in 2025-02-07 12:14:10
//! @Description:  导出file_record 表

use crate::{dao::mysql2sqlite, sys::global::GlobalResult};

use super::FileRecord;

/// @Author: DengLibin
/// @Date: Create in 2025-02-07 12:18:59
/// @Description: 启动
pub async fn start() -> GlobalResult<()> {
    let mysql_url = "mysql://denglibin:denglibin@192.168.6.177:3308/data";
    let sqlite_url = "sqlite:file_record.db";
    let colums = vec!["id".to_string(), "path".to_string()];
    let table_name = "file_record";
    let create_table_sql =
        "create table if not exists file_record(id integer primary_key, path text)";
    mysql2sqlite::mysql2sqlite::<FileRecord>(
        mysql_url,
        sqlite_url,
        table_name,
        create_table_sql,
        colums,
        0,
    )
    .await
}
